﻿using SDF.Core.Infrastructure;
using SDF.Plugin.Misc.SAPAdapter.Models;
using SDF.Plugin.Misc.SAPAdapter.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SDF.Core;

namespace SDF.Plugin.Misc.SAPAdapter.Controllers.Version1
{
    public class FunctionParamsController : SAPWebApiBase
    {
        ISAPConnectorService _sapService;

        FunctionParamsController()
        {
            _sapService = EngineContext.Current.Resolve<ISAPConnectorService>();
        }

        public IEnumerable<FunctionParamsModel> Post(FunctionPramsModel model)
        {
            model.NullCheck("model");
            model.SAPInstance.NullOrEmptyCheck("SAPInstance");
            model.FunctionName.NullOrEmptyCheck("FunctionName");

            return _sapService.GetFunctionParams(model.SAPInstance, model.FunctionName);
        }
    }
}